﻿using System;
using System.Activities;

namespace WFT.Activities
{
    /// <summary>
    /// Execute an lambda expression with the activity context in parameter
    /// </summary>
    public class LambdaActivity : CodeActivity
    {
        public LambdaActivity()
        {

        }

        public LambdaActivity(Action<ActivityContext> lambda)
        {
            Lambda = lambda;
        }

        /// <summary>
        /// Lambda expression to execute
        /// </summary>
        public Action<ActivityContext> Lambda { get; set; }

        protected override void Execute(CodeActivityContext context)
        {
            Lambda(context);
        }
    }
}
